<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>班次
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="classes" name="username" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="{$list.classe}">
                </div>

            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>开始
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" placeholder="开始日" name="start" id="start" value="{$list.start}">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>结束
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" placeholder="截止日" name="end" id="end" value="{$list.end}">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" type="button" onclick="adds({$list.id})">
                    增加
                </button>
            </div>
        </form>
    </div>
</div>

</body>
<script>
    layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
                ,type: 'time'
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
                ,type: 'time'

            });
        });
    function adds(id){
        $.ajax({
            type:"post",
            url: "{:url('home/classe/edits')}",
            data: {
                id:id,
                classe:$('#classes').val(),
                start:$('#start').val(),
                end:$('#end').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
